//
//  DemoTestCase.m
//  WiteBox
//
//  Created by John Blanco on 6/26/09.
//  Copyright 2009 Effective UI. All rights reserved.
//

#import "TestCase.h"

@interface DemoTestCase : TestCase {}
@end

@implementation DemoTestCase

- (void)testStrings {
	NSString *nilString = nil;
	NSString *emptyString = @"";
	NSString *nonEmptyString = @"something";
	
	// test string states
	ASSERT_EMPTY_STRING(nilString);
	ASSERT_EMPTY_STRING(emptyString);
	ASSERT_NON_EMPTY_STRING(nonEmptyString);
}

- (void)testStringFormatting {
	NSString *name = @"Earl";
	
	// create the string
	NSString *formattedString = [NSString stringWithFormat:@"My name is %@.", name];
	
	// test the substitution
	ASSERT_STRINGS_EQUAL(@"My name is Earl.", formattedString);
	ASSERT_STRINGS_NOT_EQUAL(@"My name is %@.", formattedString);
}

- (void)testObjectMethods {
	NSString *apple0 = nil;
	NSString *apple1 = [NSString stringWithFormat:@"apple"];
	NSString *apple2 = [NSString stringWithFormat:@"Apple"];
	NSString *apple3 = [NSString stringWithFormat:@"apple"];
	NSString *apple4 = [NSString stringWithFormat:@"orange"];
	NSString *apple5 = apple1;
	
	// test equality
	ASSERT_NIL(apple0);
	ASSERT_NOT_NIL(apple1);
	ASSERT_STRINGS_EQUAL(apple1, apple3);
	ASSERT_STRINGS_NOT_EQUAL(apple1, apple2);
	ASSERT_STRINGS_INSENSITIVE_EQUAL(apple1, apple2);
	ASSERT_STRINGS_INSENSITIVE_NOT_EQUAL(apple1, apple4);
	
	// test object equality
	ASSERT_OBJECTS_EQUAL(apple1, apple3);
	ASSERT_OBJECTS_NOT_EQUAL(apple1, apple2);
	ASSERT_OBJECTS_IDENTICAL(apple1, apple5);
	ASSERT_OBJECTS_NOT_IDENTICAL(apple1, apple3);
}

@end
